Problem with countscript

Hello,
the problem is to create a dxl script.
The script have to count the number of the values in the actuall object.

The Attribute is Order and value is ok / cancel / open
How realise this code?

Maybe something like that?

int ok = 0, cancel = 0, open=0
for....
if(Order=="ok")ok++
if(Order=="cancel")cancel++
if(Order=="open")open++
SystemAdmin - Thu Aug 26 04:15:41 EDT 2010

Re: Problem with countscript
adevicq - Thu Aug 26 05:27:34 EDT 2010

Hi,

if you want to evaluate all the objects in you Module, the script could look like:
 

Module m = current
Object o
int ok = 0, cancel = 0, open=0
string sOrder
 
for o in m do {
    sOrder = probeAttr_(o, "Order")
        
        if(sOrder=="ok")ok++
        else if(sOrder=="cancel")cancel++
        else if(sOrder=="open")open++
}

 


Regards

 

Re: Problem with countscript
SystemAdmin - Thu Aug 26 07:32:50 EDT 2010

adevicq - Thu Aug 26 05:27:34 EDT 2010

Hi,

if you want to evaluate all the objects in you Module, the script could look like:
 

Module m = current
Object o
int ok = 0, cancel = 0, open=0
string sOrder
 
for o in m do {
    sOrder = probeAttr_(o, "Order")
        
        if(sOrder=="ok")ok++
        else if(sOrder=="cancel")cancel++
        else if(sOrder=="open")open++
}

 


Regards

 

Hello thanks for helping

If i run this code

Follow Doors Window appears

"DXL Execuiton Timeout: Youmay:"

with Buttons: Halt execution / Continue / Continue, double existing timeout

if i press three times "continue" in DXL output appear the right solutions

Re: Problem with countscript
Mathias Mamsch - Thu Aug 26 07:45:09 EDT 2010

SystemAdmin - Thu Aug 26 07:32:50 EDT 2010
Hello thanks for helping

If i run this code

Follow Doors Window appears

"DXL Execuiton Timeout: Youmay:"

with Buttons: Halt execution / Continue / Continue, double existing timeout

if i press three times "continue" in DXL output appear the right solutions

That is a safety feature that allows you to halt programs that run forever. You can disable it, or better set the timeout to a higher value using:
 

pragma runLim, 1000000   // set this to 0 to disable the timeout

 


Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: Problem with countscript
mgomes - Thu Aug 26 07:48:35 EDT 2010

SystemAdmin - Thu Aug 26 07:32:50 EDT 2010
Hello thanks for helping

If i run this code

Follow Doors Window appears

"DXL Execuiton Timeout: Youmay:"

with Buttons: Halt execution / Continue / Continue, double existing timeout

if i press three times "continue" in DXL output appear the right solutions

Just add to the first line off script:

pragma runLim, 0

 


this will set to no timeout while running, but in case of infinite loops will never end. The time i think it is in milliseconds, not sure.

 

Re: Problem with countscript
SystemAdmin - Thu Aug 26 10:26:00 EDT 2010

mgomes - Thu Aug 26 07:48:35 EDT 2010

Just add to the first line off script:

pragma runLim, 0

 


this will set to no timeout while running, but in case of infinite loops will never end. The time i think it is in milliseconds, not sure.

 

Now i have a other problem.
Attribute Order and the Condition "is equal to" can be realise with ==

But how is it possible to realise "is empty" ?

My idea is to look about length=0 but i dont know how to wirte this in a dxl code.

Anyone has an idea?

Thanks

Re: Problem with countscript
Peter_Albert - Thu Aug 26 11:06:48 EDT 2010

SystemAdmin - Thu Aug 26 10:26:00 EDT 2010
Now i have a other problem.
Attribute Order and the Condition "is equal to" can be realise with ==

But how is it possible to realise "is empty" ?

My idea is to look about length=0 but i dont know how to wirte this in a dxl code.

Anyone has an idea?

Thanks

The simple option is to compare with the empty string:
 

...
int nEmpty = 0
...
if (sOrder == ""){nEmpty++}
...

 


Regards,

Peter